package com.kmust.dream.wanderingdream.product.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;

/**
 * 
 * @TableName product_sku
 */
@TableName(value ="product_sku")
@Data
public class ProductSku implements Serializable {
    /**
     * 商品sku的id
     */
    @TableId(value = "product_sku_id", type = IdType.AUTO)
    private Integer productSkuId;

    /**
     * 商品id，实为外键，方便不设
     */
    @TableField(value = "product_id")
    private Integer productId;

    /**
     * 商品属性
     */
    @TableField(value = "product_sku_properties")
    private String productSkuProperties;

    /**
     * sku描述
     */
    @TableField(value = "product_sku_desc")
    private String productSkuDesc;

    /**
     * 商品实际价格
     */
    @TableField(value = "product_sku_price")
    private Double productSkuPrice;

    /**
     * 商品库存
     */
    @TableField(value = "product_sku_stock")
    private Integer productSkuStock;

    /**
     * version，乐观锁
     */
    @TableField(value = "version")
    private Integer version;

    /**
     * sku状态
     */
    @TableField(value = "status")
    private Boolean status;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ProductSku other = (ProductSku) that;
        return (this.getProductSkuId() == null ? other.getProductSkuId() == null : this.getProductSkuId().equals(other.getProductSkuId()))
            && (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
            && (this.getProductSkuProperties() == null ? other.getProductSkuProperties() == null : this.getProductSkuProperties().equals(other.getProductSkuProperties()))
            && (this.getProductSkuDesc() == null ? other.getProductSkuDesc() == null : this.getProductSkuDesc().equals(other.getProductSkuDesc()))
            && (this.getProductSkuPrice() == null ? other.getProductSkuPrice() == null : this.getProductSkuPrice().equals(other.getProductSkuPrice()))
            && (this.getProductSkuStock() == null ? other.getProductSkuStock() == null : this.getProductSkuStock().equals(other.getProductSkuStock()))
            && (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getProductSkuId() == null) ? 0 : getProductSkuId().hashCode());
        result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
        result = prime * result + ((getProductSkuProperties() == null) ? 0 : getProductSkuProperties().hashCode());
        result = prime * result + ((getProductSkuDesc() == null) ? 0 : getProductSkuDesc().hashCode());
        result = prime * result + ((getProductSkuPrice() == null) ? 0 : getProductSkuPrice().hashCode());
        result = prime * result + ((getProductSkuStock() == null) ? 0 : getProductSkuStock().hashCode());
        result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", productSkuId=").append(productSkuId);
        sb.append(", productId=").append(productId);
        sb.append(", productSkuProperties=").append(productSkuProperties);
        sb.append(", productSkuDesc=").append(productSkuDesc);
        sb.append(", productSkuPrice=").append(productSkuPrice);
        sb.append(", productSkuStock=").append(productSkuStock);
        sb.append(", version=").append(version);
        sb.append(", status=").append(status);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}